package org.example.web;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * urlPattern配置规则
 * 一个Servlet可以配置多个访问路径
 * @WebServlet(urlPatterns = {"/servletDemo41", "/servletDemo42"})
 * 1.精确匹配
 * @WebServlet("/user/select")
 * 2.目录匹配
 * @WebServlet("/user/*")
 * 3.扩展名匹配
 * @WebServlet("*.do")
 * 4.任意匹配
 * @WebServlet("/")
 * @WebServlet("/*")
 * 优先级：
 * 精确匹配 > 目录匹配 > 扩展名匹配 > "/*" > "/"
 *
 */
@WebServlet(urlPatterns = {"/httpServletDemo21", "/httpServletDemo22"})
public class HttpServletDemo2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("httpServletDemo2_doGet?");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }
}
